#pragma once

#ifdef __cplusplus
extern "C" {
#endif

//------------------------------------------------------------------------------
// Types

// GPT timer mode
typedef enum timerMode{
    timerModePeriodic,
    timerModeFreeRunning
} timerMode_c;

// GPT timer source
typedef enum timerSrc{
    GPT_NOCLK,
    GPT_IPGCLK,
    GPT_HIGHCLK,
    GPT_EXTCLK,
    GPT_32KCLK
} timerSrc_c;

// GPT set timer mode and period 
typedef struct
{
    timerMode_c timerMode;
    UINT32 period;
    timerSrc_c timerSrc;
} GPT_Config, *pGPT_Config;

// GPT timer source packet
typedef struct
{
    timerSrc_c timerSrc;
} GPT_TIMER_SRC_PKT, *PGPT_TIMER_SRC_PKT;
//------------------------------------------------------------------------------
// Functions

HANDLE GptOpenHandle(LPCWSTR lpDevName);
BOOL GptCloseHandle(HANDLE);
HANDLE GptCreateTimerEvent(HANDLE, LPTSTR);
BOOL  GptReleaseTimerEvent(HANDLE, LPTSTR);
BOOL  GptStart(HANDLE, pGPT_Config);
BOOL  GptResume(HANDLE);
BOOL  GptStop(HANDLE);
BOOL  GptGetCounterValue(HANDLE,PDWORD);
BOOL  GptShowTimerSrc(HANDLE hGpt);

#ifdef __cplusplus
}
#endif